/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.starter.iam.initializing.local.mapping;

import com.snail.starter.iam.entity.LocalResource;
import com.snail.starter.iam.initializing.properties.ResourceYaml;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;

/**
 *
 * @author zgadmin
 * @date 2025/9/28 13:53
 *
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedSourcePolicy = ReportingPolicy.IGNORE)
public interface LocalResourceMapping {

    @Mapping(source = "parentId", target = "parentId")
    @Mapping(expression = "java(resourceNode.getPath())", target = "resourceId")
    LocalResource toLocalResource(String parentId, ResourceYaml.ResourceNode resourceNode);

}